<?php

namespace App\Controller;

use App\Exception\FileException;
use App\Model\ListModel1;
use Symfony\Component\Routing\Annotation\Route;
use App\JobEntity\Order;

class ListController extends BaseController
{
    /**
     * @Route("/list", name="list")
     */
    public function index()
    {
        /*$result = $this->getDoctrine()->getManager('default')->getRepository(Order::class)
            ->findOneBy(['id' => 1])->getArray();*/
        //throw new FileException('列表查询失败');
        try{
            $result = $this->getDoctrine('default')->getRepository(Order::class)
                ->findAllGreaterThanPrice(1);

            return $this->successView($result, 'json');
        } catch (\Exception $e) {
            throw new FileException($e->getMessage());
        }
    }
}
